package gui;

import javax.swing.JTable;
import java.awt.Color;
import java.awt.Component;
import javax.swing.table.DefaultTableCellRenderer;

public class TableColoredRenderer extends DefaultTableCellRenderer {
	@Override
    public Component getTableCellRendererComponent(
                            JTable table, Object color,
                            boolean isSelected, boolean hasFocus,
                            int row, int column) {
         Component comp = super.getTableCellRendererComponent(
                      table,  color, isSelected, hasFocus, row, column);

		 String s =  table.getModel().getValueAt(row, 1 ).toString();

		 if(s.equalsIgnoreCase("NEW")) {
			 comp.setBackground(new Color(255,200,200));
		 }else if(s.equalsIgnoreCase("MODIFIED")) {
			 comp.setBackground(new Color(150, 200, 255));
		 }else{
			 comp.setBackground(new Color(160, 255, 160));
		 }

		 return( comp );
    }
}